package edu.whu.webgis.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import edu.whu.webgis.entity.Comment;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CommentMapper extends BaseMapper<Comment> {

    @Select("select comment.id,pid,uid,nickname,date,content from comment,public.user where pid = #{pid} and comment.uid = public.user.id")
    List<Comment> selectByPid(Integer pid);

    //未测试
    @Select("select content,nickname,date from (select id from posting where posting.uid = #{uid}) t,public.user, comment where comment.pid=t.id and user.uid = comment.uid")
    List<Comment> selectByUid(Integer uid);
}
